//
//  NetworkBaseModel.swift
//  SwiftProject
//
//  Created by qindong on 2021/3/5.
//

import UIKit

/// 网络问题码 自定义
enum ErrorCode : Int, HandyJSONEnum {
    case successCode = 200
    case invalidToken = 401
    case alreadyRegisterCode = 2002
    case updateAppCode = 3002
    case newUserCode = 6001
    case redIsGetCode = 6004
    case changeMoblieCode = 6007
    case notEnoughRedCode = 6008
    case toAuthIDCode = 6071
    /// 自定义码
    case networkError = 9999
    case networkTimeout = 9998
    case defultCode = 10000
}

/// 网络基本模型
/// data为对象时
class NetworkBaseModel<T : HandyJSON>: NetworkDefualtModel {
    var data : T? = nil
}

/// data为数组时
class NetworkBaseListModel<T : HandyJSON>: NetworkDefualtModel {
    var data : [T]? = nil
}

/// data为数组（基本类型）时
class NetworkBaseDataModel<T>: NetworkDefualtModel {
    var data : T? = nil
}

/// 不关注返回数据时
class NetworkDefualtModel : HandyJSON {
    var code : ErrorCode = .defultCode
    var msg : String = ""

    required init() {}
}

class NetworkSimpleListModel<T> : NetworkDefualtModel {
    var data : [T]? = nil

    required init() {}
}

class NetworkTKListModel<T>: NetworkDefualtModel {
    var result : [Array<T>]? = nil
}

